import Person from "../practice_7/person.js";
import Student from "../practice_7/student.js";
import Class from "../practice_7/class.js";

let klass = new Class;
let studentJerry = new Student;

class Teacher extends Person{
    constructor(name,age,klass){
        super(name,age);
        this.klass = klass;
    }
    introduce(){
        if(this.klass == undefined){
            return `${super.introduce()} I am a Teacher. I teach No Class.`
        }else{
            return `${super.introduce()} I am a Teacher. I teach Class ${this.klass.number}.`
        }
    }
    introduceWith(studentJerry){
        if(studentJerry.klass.number == this.klass.number){
            return `${super.introduce()} I am a Teacher. I teach ${studentJerry.name}.`
        }else{
            return `${super.introduce()} I am a Teacher. I don't teach ${studentJerry.name}.`
        }
    }
}
module.exports = Teacher;
